package com.dhh.activity;

import com.dhh.R;
import greendroid.app.GDActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;

public class ShowFGActivity extends GDActivity implements View.OnClickListener{

	@Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setActionBarContentView(R.layout.food_group);
        initActionBar();
        
        this.findViewById(R.id.fgl_grain).setOnClickListener(this);
        this.findViewById(R.id.fgl_fruit).setOnClickListener(this);
        this.findViewById(R.id.vegetable).setOnClickListener(this);
        this.findViewById(R.id.fgl_protein).setOnClickListener(this);
        this.findViewById(R.id.fgl_dairy).setOnClickListener(this);
	}
	
	
	@Override
	public void onClick(View view) {
		Intent intent = new Intent(ShowFGActivity.this,SelectTopicActivity.class);
		if(view.getId()==R.id.fgl_grain){
			intent.putExtra("food_group", "top_grain");
		}else if(view.getId()==R.id.fgl_fruit){
			intent.putExtra("food_group", "top_fruit");
		}else if(view.getId()==R.id.vegetable){
			intent.putExtra("food_group", "top_vegetable");
		}else if(view.getId()==R.id.fgl_protein){
			intent.putExtra("food_group", "top_protein");
		}else if(view.getId()==R.id.fgl_dairy){
			intent.putExtra("food_group", "top_dairy");
		}
		this.startActivity(intent);
	}
	
	private void initActionBar(){
		getActionBar().setTitle("Help");
        getActionBar().setBackgroundColor(Color.rgb(14, 166, 249));
        getActionBar().getChildAt(0).
        	setOnClickListener(new OnClickListener(){
				@Override
				public void onClick(View v) {
					Intent intent = new Intent(ShowFGActivity.this,HomeActivity.class);	
					startActivity(intent);
				}}); 
	}

}
